import request from '@/config/axios'

export interface ProductAccessPercentageVO {
  id: number
  productAccessId: number
  deductType: string
  directProfit: number
  indirectProfit: number
  grossProfit: number
  regionalManagerRoyalty: number
  businessSupervisorRoyalty: number
  businessManagerRoyalty: number
  referrerRoyalty: number
  clientRoyalty: number
}

// 查询准入产品-提成参数列表
export const getProductAccessPercentagePage = async (params) => {
  return await request.get({ url: `/hutai/product-access-percentage/page`, params })
}

// 查询准入产品-根据订单id-提成参数详情
export const getProductAccessPercentageByOrderId = async (id: number) => {
  return await request.get({ url: `/hutai/product-access-percentage/getByOrderId?id=` + id })
}

// 查询准入产品-提成参数详情
export const getProductAccessPercentage = async (id: number) => {
  return await request.get({ url: `/hutai/product-access-percentage/get?id=` + id })
}

// 新增准入产品-提成参数
export const createProductAccessPercentage = async (data: ProductAccessPercentageVO) => {
  return await request.post({ url: `/hutai/product-access-percentage/create`, data })
}


// 新增准入产品-提成参数
export const saveOrUpdate = async (data: ProductAccessPercentageVO) => {
  return await request.post({ url: `/hutai/product-access-percentage/saveOrUpdate`, data })
}


// 修改准入产品-提成参数
export const updateProductAccessPercentage = async (data: ProductAccessPercentageVO) => {
  return await request.put({ url: `/hutai/product-access-percentage/update`, data })
}

// 删除准入产品-提成参数
export const deleteProductAccessPercentage = async (id: number) => {
  return await request.delete({ url: `/hutai/product-access-percentage/delete?id=` + id })
}

// 导出准入产品-提成参数 Excel
export const exportProductAccessPercentage = async (params) => {
  return await request.download({ url: `/hutai/product-access-percentage/export-excel`, params })
}
